package edu.lingnan.house.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import edu.lingnan.house.mapper.HostMapper_lxj;
import edu.lingnan.house.pojo.TbUser;
import edu.lingnan.house.service.HostService_lxj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HostServiceImpl_lxj implements HostService_lxj {
    @Autowired
    private HostMapper_lxj hostMapper;

    //查找个人信息
    @Override
    public TbUser findSelfById(String userId) {
        QueryWrapper<TbUser> queryWrapper = new QueryWrapper();
        queryWrapper.eq("id",userId);
        TbUser user = hostMapper.selectOne(queryWrapper);
        return user;
    }

    //修改个人信息
    @Override
    public int updateMySelf(TbUser user) {
        QueryWrapper<TbUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",user.getId());
        int row = hostMapper.update(user, queryWrapper);
        return row;
    }
}
